﻿using System;

namespace problem_6
{
    public class Calculator
    {
        public static int SumOfSquares(int toValue)
        {
            var sum = 0;
            for (var i = 0; i <= toValue ; i++)
            {
                var square = i * i;
                sum += square;
            }

            return sum;
        }

        public static int SquareOfSums(int toValue)
        {
            var sum = 0;
            for (var i = 0; i <= toValue; i++)
            {
                sum += i;
            }
            return sum*sum;
        }

        public static int DiffSumSquaresSquareSums(int toValue)
        {
            var sumSquare = SumOfSquares(toValue);
            var squareSums = SquareOfSums(toValue);
            return squareSums - sumSquare;
        }
    }
}
